#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QMainWindow>
#include <QMenuBar>
#include <QDateTime>
#include <QDomDocument>
#include <QSplitter>
#include <QMessageBox>

class QStandardItemModel;

namespace Ui {
class Widget;
}

class Widget : public QMainWindow
{
    Q_OBJECT
public:
    explicit Widget(QWidget *parent = 0);
    ~Widget();
    //“销售管理”，“修改密码”主菜单
    QMenu *manageMenu;
    QMenu *passwordMenu;
//动作Action定义
    QAction *manageAction;
    QAction *chartAction;
    QAction *quitAction;
//实现“品牌车管理”，“销售统计”，”退出“子菜单功能函数

    enum DateTimeType{Time,Date,DateTime};

    QString getDateTime(DateTimeType type);
private slots:
    void on_manageMenu_clicked();
    void on_chartMenu_clicked();
    void on_quitMenu_clicked();
    void on_sellFactoryComboBox_currentIndexChanged(const QString &arg1);

    void on_sellCancelBtn_clicked();

    void on_sellBrandComboBox_currentIndexChanged(const QString &arg1);

    void on_sellNumSpinBox_valueChanged(int arg1);

    void on_sellOkBtn_clicked();

    void on_factoryComboBox_currentIndexChanged(const QString &arg1);

    void on_updateBtn_clicked();

private:
    Ui::Widget *ui;
    void createMenuBar();//用于生菜单栏的函数
    QDomDocument doc;
    bool docRead();
    bool docWrite();
    void writeXml();
    void createNodes(QDomElement &date);
    void showDailyList();
    QStandardItemModel *chartModel;
    void createChartModelView();
    void showChart();
};

#endif // WIDGET_H
